/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.miracleteam.miracle.utils;

import com.miracleteam.miracle.entities.Sanpham;
import com.miracleteam.miracle.services.SanPhamService;
import com.miracleteam.miracle.services.servicesImpl.SanPhamServiceImpl;
import org.apache.tapestry5.ValueEncoder;

/**
 *
 * @author DangKhoa
 */
public class SanPhamEncoder  implements ValueEncoder<Sanpham>  {
    
    public String toClient(Sanpham v) {
        return v.getMaSanPham();
    }

    public Sanpham toValue(String string) {
        SanPhamService spServ=new SanPhamServiceImpl();
        return spServ.LaySanPham(string);
    }
}
